# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AndroidPublisher.V3.Model.VoidedPurchase do
  @moduledoc """
  A VoidedPurchase resource indicates a purchase that was either canceled/refunded/charged-back.

  ## Attributes

  *   `kind` (*type:* `String.t`, *default:* `nil`) - This kind represents a voided purchase object in the androidpublisher service.
  *   `orderId` (*type:* `String.t`, *default:* `nil`) - The order id which uniquely identifies a one-time purchase, subscription purchase, or subscription renewal.
  *   `purchaseTimeMillis` (*type:* `String.t`, *default:* `nil`) - The time at which the purchase was made, in milliseconds since the epoch (Jan 1, 1970).
  *   `purchaseToken` (*type:* `String.t`, *default:* `nil`) - The token which uniquely identifies a one-time purchase or subscription. To uniquely identify subscription renewals use order_id (available starting from version 3 of the API).
  *   `voidedQuantity` (*type:* `integer()`, *default:* `nil`) - The voided quantity as the result of a quantity-based partial refund. Voided purchases of quantity-based partial refunds may only be returned when includeQuantityBasedPartialRefund is set to true.
  *   `voidedReason` (*type:* `integer()`, *default:* `nil`) - The reason why the purchase was voided, possible values are: 0. Other 1. Remorse 2. Not_received 3. Defective 4. Accidental_purchase 5. Fraud 6. Friendly_fraud 7. Chargeback 8. Unacknowledged_purchase
  *   `voidedSource` (*type:* `integer()`, *default:* `nil`) - The initiator of voided purchase, possible values are: 0. User 1. Developer 2. Google
  *   `voidedTimeMillis` (*type:* `String.t`, *default:* `nil`) - The time at which the purchase was canceled/refunded/charged-back, in milliseconds since the epoch (Jan 1, 1970).
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :kind => String.t() | nil,
          :orderId => String.t() | nil,
          :purchaseTimeMillis => String.t() | nil,
          :purchaseToken => String.t() | nil,
          :voidedQuantity => integer() | nil,
          :voidedReason => integer() | nil,
          :voidedSource => integer() | nil,
          :voidedTimeMillis => String.t() | nil
        }

  field(:kind)
  field(:orderId)
  field(:purchaseTimeMillis)
  field(:purchaseToken)
  field(:voidedQuantity)
  field(:voidedReason)
  field(:voidedSource)
  field(:voidedTimeMillis)
end

defimpl Poison.Decoder, for: GoogleApi.AndroidPublisher.V3.Model.VoidedPurchase do
  def decode(value, options) do
    GoogleApi.AndroidPublisher.V3.Model.VoidedPurchase.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AndroidPublisher.V3.Model.VoidedPurchase do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
